<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateAkbusMrCostDetailTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('akbus_mr_cost_detail', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->string('content')->nullable()->comment('维修内容');
            $table->integer('type')->nullable()->comment('维修类型');
            $table->decimal('amount')->nullable()->comment('维修金额');
            $table->unsignedBigInteger('mr_cost_id')->comment('维修费用单ID');
            $table->foreign('mr_cost_id')->references('id')->on('akbus_mr_cost')->onDelete('cascade');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('akbus_mr_cost_detail');
    }
}
